/**
 * 
 */
package com.netflexitysolutions.amazonws.sdb.orm.filter;

/**
 * @author netflexity
 *
 */
public enum ComparisonType {
	
	IS_NULL(1, " is null "),
    EQUALS(2," = "),
    GREATER_THAN(3," > "),
    LESS_THAN(4," < "),
    LIKE(5," like "),
    IN(6," in"),
    NOT_NULL(-1," is not null "),
    NOT_EQUALS(-2," != "),
    LESS_THAN_EQUALS(-3," <= "),
    GREATER_THAN_EQUALS(-4," >= "),
    NOT_LIKE(-5, " not like "),
    NOT_IN(-6, " not in");
    
	private String operator;
	private int type;
	
	/**
	 * @param type
	 * @param operator
	 */
	private ComparisonType(int type, String operator){
		this.operator = operator;
		this.type = type;
	}

	/**
	 * @return the operator
	 */
	public String getOperator() {
		return operator;
	}

	/**
	 * @return the type
	 */
	public int getType() {
		return type;
	}
	
	/**
     * @param type
     * @return
     */
    public static ComparisonType getEnum(int type){
        for (ComparisonType en : values()) {
            if(type == en.getType()){
                return en;
            }
        }
        return null;
    }
}
